<template>
  <div class="app-container">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="right" label-width="150px" style="margin-left: 30px">
      <div>
        <span>清除缓存</span>
        <el-divider></el-divider>
      </div>
      <el-form-item label="缓存KEY:" prop="key">
        <el-input v-model="ruleForm.key" style="width: 323.06px"></el-input>
      </el-form-item>
      <el-form-item label="*全部删除:">PC(输入PC，删除PC端首页所有缓存);MOBILE(输入MOBILE，删除移动端首页所有缓存);</el-form-item>
      <el-form-item label="*移动端KEY:">
        MOBILE_INDEX_BANNER(移动端轮播图);MOBILE_INDEX_FLOOR(移动端楼层);MOBILE_INDEX_RECOMMEND(移动端多惠部落);
        <br />
        MOBILE_INDEX_SPECIAL(移动端专题活动);MOBILE_INDEX_BIDDING(移动端阶梯竞价);MOBILE_INDEX_GROUP(移动端团购);
        <br />
        MOBILE_INDEX_COUPON(移动端优惠券);MOBILE_TOP_CATE(移动端推荐分类);MOBILE_INDEX_CATE(移动端分类信息);
      </el-form-item>
      <el-form-item label="*PC端KEY:">
        INDEX_HTML_BANNER(PC端轮播图);INDEX_HTML_FLOOR(PC端楼层);INDEX_HTML_RECOMMEND(PC端多惠部落);
        <br />
        INDEX_HTML_PCIMAGE(PC相关图片);INDEX_HTML_CATE(PC首页分类);INDEX_HTML_BIDDING(PC阶梯竞价);
        <br />
        INDEX_HTML_PRODUCTS(PC首页为你推荐);
      </el-form-item>
      <el-form-item>
        <div class="fixed-bottom-20">
          <el-button type="primary" @click="submitForm('ruleForm')">立即提交</el-button>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { Message } from "element-ui";
import { clearCache } from "@/api/system";
export default {
  name: "alipayconfig",
  data() {
    return {
      ruleForm: {
        key: "",
      },
      rules: {
        key: [
          {
            required: true,
            message: "请输入KEY",
            trigger: "blur",
          },
          {
            max: 50,
            message: "不能超过50个字符",
            trigger: "blur",
          },
        ],
      },
    };
  },
  methods: {
    submitForm(ruleForm) {
      this.$refs[ruleForm].validate((valid) => {
        if (valid) {
          clearCache(this.ruleForm).then((res) => {
            if (!res.data.success) {
              Message.error(res.data.message);
              return;
            }
            Message.success("操作成功");
            return;
          });
        }
      });
    },
  },
};
</script>
<style></style>
